<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const p1 =()=>{
            return new Promise((resolve,reject)=>{
                setTimeout(()=>{
                      console.log('1');
                      resolve('1')  
                      //reject('a')
                },1000)
            })
        }        
        const p2 =()=>{
            return new Promise((resolve,reject)=>{
                setTimeout(()=>{
                      console.log('2');
                      resolve('2')  
                },500)
            })
        }        
        const p3 =()=>{
            return new Promise((resolve,reject)=>{
                setTimeout(()=>{
                      console.log('3');
                      resolve('3')  
                },1200)
            })
        }
        p1().then((res)=>{
            console.log('p1 res',res)
            return p2()
        }).then((res)=>{
            console.log('p2 res',res)
            return p3()
        }).then((res)=>{
            console.log('p3 res',res)
        })
    </script>
</body>
</html>